package com.hsl.housaileibot001.service.impl;

import com.hsl.housaileibot001.document.MockQuestion;
import com.hsl.housaileibot001.repository.MockQuestionRepository;
import com.hsl.housaileibot001.service.MockQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 模拟题目服务实现类
 */
@Service
public class MockQuestionServiceImpl implements MockQuestionService {

    @Autowired
    private MockQuestionRepository mockQuestionRepository;

    @Override
    public MockQuestion save(MockQuestion mockQuestion) {
        return mockQuestionRepository.save(mockQuestion);
    }

    @Override
    public List<MockQuestion> findActiveByInterviewQuestionId(Long interviewQuestionId) {
        return mockQuestionRepository.findByInterviewQuestionIdAndStatus(interviewQuestionId, "ACTIVE");
    }

    @Override
    public MockQuestion findById(String id) {
        return mockQuestionRepository.findById(id).orElse(null);
    }

    @Override
    public List<MockQuestion> findByInterviewQuestionId(Long interviewQuestionId) {
        return mockQuestionRepository.findByInterviewQuestionId(interviewQuestionId);
    }

    @Override
    public List<MockQuestion> findByStatus(String status) {
        return mockQuestionRepository.findByStatus(status);
    }

    @Override
    public List<MockQuestion> findByInterviewQuestionIdAndStatus(Long interviewQuestionId, String status) {
        return mockQuestionRepository.findByInterviewQuestionIdAndStatus(interviewQuestionId, status);
    }

    @Override
    public void deleteById(String id) {
        mockQuestionRepository.deleteById(id);
    }

    @Override
    public List<MockQuestion> findAll() {
        return mockQuestionRepository.findAll();
    }
}
